<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Swiper demo</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
    <!-- Link Swiper's CSS -->
    <link rel="stylesheet" href="swiper.css">

    <!-- Demo styles -->
    <style>
    html, body {
        position: relative;
        height: 100%;
    }
    body {
        
        background: #000;
        font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
        font-size: 14px;
        color:#000;
        margin: 0 ;
        padding: 0;
    }
    .swiper-container {
        width: 100%;
        height: 300px;
        margin-left: auto;
        margin-right: auto;
    }
    .swiper-slide {
        background-size: cover;
        background-position: center;
    }
    .gallery-top {
        height: 80%;
        width: 100%;
    }
    .gallery-thumbs {
        height: 20%;
        box-sizing: border-box;
        padding: 10px 0;
    }
    .gallery-thumbs .swiper-slide {
        height: 100%;
        opacity: 0.4;
    }
    .gallery-thumbs .swiper-slide-active {
        opacity: 1;
    }
    
    </style>
</head>
<body>
    <!-- Swiper -->
    <div class="swiper-container gallery-top">
        <div class="swiper-wrapper">
            <div class="swiper-slide" style="background-image:url(images/01.jpg)"></div>
            <div class="swiper-slide" style="background-image:url(images/02.jpg)"></div>
            <div class="swiper-slide" style="background-image:url(images/03.jpg)"></div>
            <div class="swiper-slide" style="background-image:url(images/04.jpg)"></div>
            <div class="swiper-slide" style="background-image:url(images/05.jpg)"></div>
            
        </div>
        <!-- Add Arrows -->
        <div class="swiper-button-next swiper-button-white"></div>
        <div class="swiper-button-prev swiper-button-white"></div>
    </div>
    <div class="swiper-container gallery-thumbs">
        <div class="swiper-wrapper">
            <div class="swiper-slide" style="background-image:url(images/01.jpg)"></div>
            <div class="swiper-slide" style="background-image:url(images/02.jpg)"></div>
            <div class="swiper-slide" style="background-image:url(images/03.jpg)"></div>
            <div class="swiper-slide" style="background-image:url(images/04.jpg)"></div>
            <div class="swiper-slide" style="background-image:url(images/05.jpg)"></div>
        </div>
    </div>

    <!-- Swiper JS -->
    <script src="swiper.js"></script>

    <!-- Initialize Swiper -->
    <script>
    var galleryTop = new Swiper('.gallery-top', {
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        spaceBetween: 10,//slide之间的距离（单位px）。
        loop:true,//设置为true 则开启loop模式。loop模式：会在原本slide前后复制若干个slide并在合适的时候切换，让Swiper看起来是循环的
        //autoplay: 3000,//自动切换的时间间隔（单位ms），不设定该参数slide不会自动切换。
        loopedSlides: 5, //在loop模式下使用slidesPerview:'auto',还需使用该参数设置所要用到的loop个数。  
    });
    var galleryThumbs = new Swiper('.gallery-thumbs', {
        spaceBetween: 10,//slide之间的距离（单位px）。
        //centeredSlides: true,
        slidesPerView: 4,
        //设置slider容器能够同时显示的slides数量(carousel模式)。可以设置为number或者 'auto'则自动根据slides的宽度来设定数量。
        loop:true,//设置为true 则开启loop模式。loop模式：会在原本slide前后复制若干个slide并在合适的时候切换，让Swiper看起来是循环的
        loopedSlides: 5, //在loop模式下使用slidesPerview:'auto',还需使用该参数设置所要用到的loop个数。
        slideToClickedSlide: true//设置为true则swiping时点击slide会过渡到这个slide。
    });
    galleryTop.params.control = galleryThumbs;
    galleryThumbs.params.control = galleryTop;
    
    </script>
</body>
</html>
